package com.xjh.him.fragment.emotion;

import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.GridView;

import androidx.annotation.NonNull;

import com.xjh.him.core.BaseFragment;
import com.xjh.him.databinding.AdapterEmotionPagerItemBinding;
import com.xuexiang.xpage.annotation.Page;
import com.xuexiang.xui.widget.actionbar.TitleBar;

@Page(name = "表情面板")
public abstract class BaseEmotionPanelFragment extends BaseFragment<AdapterEmotionPagerItemBinding> {

    @NonNull
    @Override
    protected AdapterEmotionPagerItemBinding viewBindingInflate(LayoutInflater inflater, ViewGroup container) {
        return AdapterEmotionPagerItemBinding.inflate(inflater, container, false);
    }

    @Override
    protected TitleBar initTitle() {
        return null;
    }

    @Override
    protected abstract void initViews();

    protected GridView initGridViewParams(int padding, int gvWidth, int gvHeight) {
        GridView gv = binding.emotionGrid;
        gv.setNumColumns(7);
        gv.setPadding(padding, padding, padding, padding);
        gv.setHorizontalSpacing(padding);
        gv.setVerticalSpacing(padding);

        ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(gvWidth, gvHeight);
        gv.setLayoutParams(params);
        return gv;
    }
}
